// Generated from <%= script_name %>

package <%= package_name %>;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.shopify.graphql.support.AbstractResponse;
import com.shopify.graphql.support.Arguments;
import com.shopify.graphql.support.Error;
import com.shopify.graphql.support.Query;
import com.shopify.graphql.support.SchemaViolationError;
import com.shopify.graphql.support.TopLevelResponse;
import com.shopify.graphql.support.Input;
<% imports.each do |import| %>
  import <%= import %>;
<% end %>

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

    <% case type.kind when 'OBJECT', 'INTERFACE', 'UNION' %>
    <% when 'INPUT_OBJECT' %>
    <% when 'ENUM' %>
        <%= java_doc(type) %>
        public enum <%= type.name %> {
          <% type.enum_values(include_deprecated: include_deprecated).each do |value| %>
            <%= java_doc(value) %>
            <%= value.deprecated? ? "@Deprecated\n" : '' -%>
            <%= value.upcase_name %>,
          <% end %>

          UNKNOWN_VALUE;

          public static <%= type.name %> fromGraphQl(String value) {
            if (value == null) {
              return null;
            }

            switch (value) {
              <% type.enum_values(include_deprecated: include_deprecated).each do |value| %>
                case "<%= value.name %>": {
                  return <%= value.upcase_name %>;
                }
              <% end %>
                default: {
                  return UNKNOWN_VALUE;
                }
            }
          }
          public String toString() {
            switch (this) {
              <% type.enum_values(include_deprecated: include_deprecated).each do |value| %>
                case <%= value.upcase_name %>: {
                  return "<%= value.name %>";
                }
              <% end %>
                default: {
                  return "";
                }
            }
          }
        }
    <% else %>
        <% raise NotImplementedError, "unhandled #{type.kind} type #{type.name}" %>
    <% end %>
